package com.example.sjjg.utest

import android.widget.Button
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.sjjg.utest.view.MainActivity
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
class RobolectricView {
    @Test
    fun testView(){
        val controller = Robolectric.buildActivity(MainActivity::class.java).setup()
        val activity = controller.get()
        val button : Button = activity.findViewById(R.id.button)
        val txt = button.getText().toString()
        assertThat(txt == """test button""")
    }
}
@RunWith(AndroidJUnit4::class)
class AndroidXTestView{
    fun testView(){
        /*// GIVEN
        val contactName = "Test User"
        val scenario = ActivityScenario.launch(MainActivity::class.java)

        // WHEN
        Espresso.onView(withId(R.id.contact_name_text)).perform(typeText(contactName))
        // Destroy and recreate Activity
        scenario.recreate()

        // THEN
        // Check contact name was preserved.
        Espresso.onView(withId(R.id.contact_name_text)).check(matches(withText(contactName)))*/
    }
}